<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="index.xhtml">
	<ui:define name="body">
		<script type="text/javascript">
			$(document).ready(function() {
				$(".submenu-active").removeClass('submenu-active');
				$("#utilisateur").addClass('submenu-active');
			});
		</script>
		<f:view>
			<p:confirmDialog id="canNotDeleteUserId"
				header="Supression utilisateur"
				message="Vous pouvez pas supprimer l'utulisateur #{utilisbeant.selectedUser.firstName}  car son Il le pere d'un autre utilisateur "
				widgetVar="canNotDeleteUserWv" modal="true" severity="alert"
				visible="#{utilisbeant.showCanNotDeleteUserHasSuperUser}">

				<div align="right">

					<p:commandButton id="canNotDeleteUse3344sId" value="Ok"
						oncomplete="canNotDeleteUserWv.hide()" />
				</div>

			</p:confirmDialog>

			<p:confirmDialog id="delUserId" header="Supression utilisateur"
				widgetVar="delUserWv" modal="true">
				<f:facet name="message">
					<p:outputPanel>
						<h:outputFormat
							value="Etes vous sur de vouloir supprimer cet utulisateur #{utilisbeant.selectedUser.firstName}   ">

						</h:outputFormat>
					</p:outputPanel>
				</f:facet>
				<h:form>

					<div align="right">
						<p:commandButton id="deleteUserConfirmId" value="Supprimer"
							update=":listUserFormId:dataTableAllUsersId :canNotDeleteUserId"
							oncomplete="delUserWv.hide()"
							actionListener="#{utilisbeant.deleteUser}" />
						<p:commandButton id="cancelDeleteUser233344sId" value="Annuler"
							oncomplete="delUserWv.hide()" />
					</div>
				</h:form>
			</p:confirmDialog>
			<p:dialog id="editUserId" modal="false" resizable="false"
				widgetVar="editUserMPWv" style="font-size: 0.9em" height="600"
				width="800" message="Editer Utilisateur">
				<p:panel id="panelEditUser">
					<h:form id="formEditUser123Id">
						<div align="center">

							<ui:include src="editUser.xhtml"></ui:include>
							<p:commandButton id="saveEditedUserId" value="Enregistrer"
								oncomplete="editUserMPWv.hide()"
								actionListener="#{utilisbeant.editUser}"
								update=":listUserFormId:dataTableAllUsersId" />
							<p:commandButton id="cancelEditUserId" value="Annuler"
								oncomplete="editUserMPWv.hide()" immediate="true" />
						</div>
					</h:form>
				</p:panel>
			</p:dialog>
			<h:form id="listUserFormId">
				<h1>Utilisateurs</h1>
				<table width="100%" class="nostyle">
					<tr>
						<td>
							<h3>Comptes utilisateurs</h3> <!-- class="tit" --> <p:spacer
								width="300" height="5"></p:spacer>
						</td>
						<td><p:commandButton
								value="Revenir au paramétrage général utilisateurs"
								style="font-size: 0.9em" immediate="true"
								action="utilisateur?faces-redirect=true" /></td>
					</tr>
				</table>
				<table width="100%" class="tit">
					<tr>
						<td class="no_border" width="250">
							<p class="t-justify">
								<p:inputText />
								<p:button id="b" icon="ui-icon-search"></p:button>
								<!-- style="font-size:12.5px" -->
							</p>
						</td>
						<td class="no_border" width="150">
							<p class="t-justify">
								<p:commandButton value="Créer un utilisateur"
									style="font-size: 0.9em"
									action="utilisateurFormulaire?faces-redirect=true" />
							</p>
						</td>
						<td class="no_border"><p:commandButton
								value="Envoyer un email" style="font-size: 0.9em" /> <!-- action="" width="150"-->
							<p:spacer width="100" height="5"></p:spacer></td>
						<td class="no_border">
							<p class="t-justify">
								<h:commandLink>
									<p:graphicImage value="images/iconExcel.png" />
									<p:dataExporter type="xls" target="tbl" fileName="cars" />
								</h:commandLink>
								<h:commandLink>
									<p:graphicImage value="images/pdf.png" />
									<p:dataExporter type="pdf" target="tbl" fileName="cars" />
								</h:commandLink>
								<h:commandLink>
									<p:graphicImage value="images/imprimante.png" />
									<p:dataExporter type="cvs" target="tbl" fileName="cars" />
								</h:commandLink>

							</p>
						</td>
					</tr>
				</table>
				<br></br>
				<br></br>
				<p:dataTable id="dataTableAllUsersId" var="userr"
					value="#{utilisbeant.allUsers}" widgetVar="dataTableAllUsersWv"
					style="width:100%">
					<p:column style="width:18px" />
					<p:column headerText="Prénom">
						<center>#{userr.lastName}</center>
					</p:column>
					<p:column headerText="Nom">
						<center>#{userr.firstName}</center>
					</p:column>
					<p:column headerText="Email">
						<center>#{userr.email}</center>
					</p:column>
					<p:column headerText="Rôle">
						<center>#{userr.roleName}</center>
					</p:column>
					<p:column headerText="Magasin">
						<center>#{userr.enseigneName}</center>
					</p:column>
					<p:column headerText="Supérieur hiérarchique">
						<center>#{userr.superUserFullName}</center>
					</p:column>
					<p:column headerText="Mail envoyé" style=" width:15px">
						<center>
							<input type="checkbox" name=""
								value="#{userr.superUser.mailSended}" checked="checked" />
						</center>
					</p:column>
					<p:column style=" width:15px">
						<div align="center">
							<p:commandButton id="selectButton"
								action="addPointDeVente.xhtml?faces-redirect=true}"
								icon="ui-icon-pencil" title="View" style="font-size:8px" />
						</div>
					</p:column>
					<p:column style=" width:15px">
						<div align="center">
							<p:commandButton icon="ui-icon-circle-close" update=":delUserId"
								oncomplete="delUserWv.show()" title="Suppression un utulisateur"
								style="font-size:6px">
								<f:setPropertyActionListener value="#{userr}"
									target="#{utilisbeant.selectedUser}" />
							</p:commandButton>
						</div>
					</p:column>
					<p:column>
						<div align="center">
							<p:commandButton icon="ui-icon-circle-plus" update=":editUserId"
								oncomplete="editUserMPWv.show()" title="Editer un utulisateur"
								style="font-size:6px">
								<f:setPropertyActionListener value="#{userr}"
									target="#{utilisbeant.selectedUser}" />
							</p:commandButton>
						</div>
					</p:column>
				</p:dataTable>

			</h:form>
		</f:view>
	</ui:define>
</ui:composition>